#include "com_tyjf_payment_util_des_DesDemo.h"
#include <string.h>

JNIEXPORT jstring JNICALL Java_com_tyjf_payment_util_des_DesDemo_DesPinEnc(JNIEnv *env, jclass jc, jstring acno, jstring pin)
 {
	 char EnPin[32];
	 char *_EnPin = NULL;
	 memset(EnPin,0x00,sizeof(EnPin));
         char * c_acno=(char*)(*env)->GetStringUTFChars(env, acno, NULL);//注意此处jstring和char *的转换
         char * c_pin=(char*)(*env)->GetStringUTFChars(env, pin, NULL);//注意此处jstring和char *的转换
         //char * c_key=(char*)(*env)->GetStringUTFChars(env, key, NULL);//注意此处jstring和char *的转换
	 char * c_key="d89d98e333b71a2";
	 /*
         printf("c_acno:%s--------\n",c_acno); 
         printf("c_pin:%s--------\n",c_pin); 
         printf("c_key:%s--------\n",c_key);
	*/ 
	 call_t3des_enc(c_acno,c_pin,c_key,EnPin);
	 //memcpy(EnPin,_EnPin,strlen(_EnPin));
	 return (*env)->NewStringUTF(env,EnPin);
 } 

JNIEXPORT jstring JNICALL Java_com_tyjf_payment_util_des_DesDemo_DesPinDec(JNIEnv *env, jclass jc, jstring acno, jstring pin)
 {
         char EnPin[32];
         char *_EnPin = NULL;
         memset(EnPin,0x00,sizeof(EnPin));
         char * c_acno=(char*)(*env)->GetStringUTFChars(env, acno, NULL);//注意此处jstring和char *的转换
         char * c_pin=(char*)(*env)->GetStringUTFChars(env, pin, NULL);//注意此处jstring和char *的转换
         //char * c_key=(char*)(*env)->GetStringUTFChars(env, key, NULL);//注意此处jstring和char *的转换
	 char * c_key="d89d98e333b71a2";
	/*
         printf("c_acno:%s--------\n",c_acno);
         printf("c_pin:%s--------\n",c_pin);
         printf("c_key:%s--------\n",c_key);
	*/
         call_t3des_dec(c_acno,c_pin,c_key,EnPin);
         //memcpy(EnPin,_EnPin,strlen(_EnPin));
         return (*env)->NewStringUTF(env,EnPin);
 }
